package com.ruoyi.lucky.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.lucky.mapper.TRedBagMapper;
import com.ruoyi.lucky.domain.TRedBag;
import com.ruoyi.lucky.service.ITRedBagService;
import com.ruoyi.common.core.text.Convert;

/**
 * 口令红包Service业务层处理
 * 
 * @author liuhongbin
 * @date 2020-11-24
 */
@Service
public class TRedBagServiceImpl implements ITRedBagService 
{
    @Autowired
    private TRedBagMapper tRedBagMapper;

    /**
     * 查询口令红包
     * 
     * @param id 口令红包ID
     * @return 口令红包
     */
    @Override
    public TRedBag selectTRedBagById(Long id)
    {
        return tRedBagMapper.selectTRedBagById(id);
    }

    /**
     * 查询口令红包列表
     * 
     * @param tRedBag 口令红包
     * @return 口令红包
     */
    @Override
    public List<TRedBag> selectTRedBagList(TRedBag tRedBag)
    {
        return tRedBagMapper.selectTRedBagList(tRedBag);
    }

    /**
     * 新增口令红包
     * 
     * @param tRedBag 口令红包
     * @return 结果
     */
    @Override
    public int insertTRedBag(TRedBag tRedBag)
    {
        tRedBag.setCreateTime(DateUtils.getNowDate());
        return tRedBagMapper.insertTRedBag(tRedBag);
    }

    /**
     * 修改口令红包
     * 
     * @param tRedBag 口令红包
     * @return 结果
     */
    @Override
    public int updateTRedBag(TRedBag tRedBag)
    {
        tRedBag.setUpdateTime(DateUtils.getNowDate());
        return tRedBagMapper.updateTRedBag(tRedBag);
    }

    /**
     * 删除口令红包对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteTRedBagByIds(String ids)
    {
        return tRedBagMapper.deleteTRedBagByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除口令红包信息
     * 
     * @param id 口令红包ID
     * @return 结果
     */
    @Override
    public int deleteTRedBagById(Long id)
    {
        return tRedBagMapper.deleteTRedBagById(id);
    }
}
